package com.coin900.coin.server.fsc.ctrl;

import com.coin900.coin.base.AjaxResponse;
import com.coin900.coin.base.FuConstants;
import com.coin900.coin.persist.fu.FuUserVO;
import com.coin900.coin.server.fu.ctrl.FuController;
import com.coin900.coin.service.fu.IFuUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author shui
 * @create 2017-11-22
 **/
@Controller
public class FscUserCtrl extends FuController {

    /**
     * 手机端-用户中心
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/user-center", method = RequestMethod.GET)
    public ModelAndView userCenter(@RequestParam String viewType,
                                   HttpServletRequest request) {
        if (FuConstants.FU_PAGE.equals(viewType)) {
            ModelAndView modelAndView = super.buildView(request, "/mobile/project/member");
            FuUserVO user = super.getUser();
            Long userId = user.getId();
            Map<String, Object> params = new HashMap<>();
            // 账号信息
//            params.put("userId", userId);
//            params.put("dataStatus", 1);
//            List<FuUserVO> fuUserVOS = this.userService.loadUserAndInfo(params);
//            FuUserVO userVO = fuUserVOS.get(0);
//            AjaxResponse response = super.buildAjaxResponse(request);
//            response.addModel(userVO);
//            modelAndView.addObject("model", response.getModelMap());
            return modelAndView;
        }
        return null;
    }

    @Autowired
    private IFuUserService userService;

}
